package cn.zongtilei;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class CookieServlet extends HttpServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// 创建一个cookie，里面的值解释key value
		/**
		 * Cookie会以相应头的形式发送给客户端 cookie里面不能放中文
		 */
		Cookie cookie = new Cookie("goods", "IPhoneX");
		resp.addCookie(cookie); // 先放到response中了么?然后去客户端.放到客户端的机器上.
	}

}
